#pragma once

#include <string>
#include "leveldb/slice.h"

namespace leveldb {
    class Slice;
}

class KeyValueParser {
public:
	explicit KeyValueParser(const leveldb::Slice & bytes);
	~KeyValueParser();

	bool key(uint64_t * key);
	bool value(leveldb::Slice * result);

	bool keyValue(uint64_t * key, leveldb::Slice * result);

private:
	leveldb::Slice bytes_;
};

class  KeyValueBuilder {
public:
    void put(uint64_t key, const leveldb::Slice & value);
    void clear();
    size_t approximateSize() const ;
    const std::string & contents() const ;

    const std::string toString() const ;
private:
    std::string bytes_;
};
